local game = require 'club.threecard.texas'

local hand_tip = game.ui.element()

hand_tip.store_watchers = 
{
    ingame = 
    {
        ['同步手牌牌型'] = function(self, store, state, args, init)
            if init then
                return
            end

            self:update(state.self_handtype)
        end,

        ['阶段变更'] = function(self, store, state, args, init)
            if state.phase_id == game.store.ingame.state.phases.idle.id
            or state.phase_id == game.store.ingame.state.phases.ready.id
            or state.phase_id == game.store.ingame.state.phases.button.id
            or state.phase_id == game.store.ingame.state.phases.perflop.id
            or state.phase_id == game.store.ingame.state.phases.settle.id then
                self:hide()
            end
        end
    }
}

function hand_tip:ctor()
    self.res = 'club.threecard.texas/ui/ingame.b:hand_tip'
end

function hand_tip:update(handtype)
    self:show()
    self.txt.text = game.i18n.text(string.format('texas:牌型_%s', handtype))
end

return hand_tip